var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("FlyScrpit"),
    i = t("OnClick"),
    s = cc._decorator,
    c = s.ccclass,
    l =
        (s.property,
        (function (t) {
            function e() {
                return (null !== t && t.apply(this, arguments)) || this;
            }
            var o;
            return (
                n(e, t),
                (o = e),
                (e.prototype.start = function () {
                    var t = this;
                    this.scheduleOnce(function () {
                        var e = t.node.convertToWorldSpaceAR(new cc.Vec2(0, 0));
                        (e = cc.Canvas.instance.node.convertToNodeSpaceAR(e)),
                            (o.goldX = e.x),
                            (o.goldY = e.y),
                            (o.inst = t),
                            (t.sf = t.node.getComponent(cc.Sprite).spriteFrame);
                    });
                }),
                (e.show = function (t) {
                    void 0 === t && (t = !1);
                    for (
                        var e = t ? this.goldX : i.default.out.x,
                            o = t ? this.goldY : i.default.out.y,
                            n = t ? i.default.out.x : this.goldX,
                            r = t ? i.default.out.y : this.goldY,
                            a = function (t) {
                                var a = 0.05 * t,
                                    i = new cc.Node();
                                (i.addComponent(cc.Sprite).spriteFrame = s.inst.sf),
                                    (i.x = e),
                                    (i.y = o),
                                    cc.Canvas.instance.node.addChild(i),
                                    cc
                                        .tween(i)
                                        .delay(a)
                                        .to(0.6, {x: n, y: r})
                                        .call(function () {
                                            i.destroy();
                                        })
                                        .start();
                            },
                            s = this,
                            c = 0;
                        c < 3;
                        c++
                    )
                        a(c);
                }),
                (e.show1 = function (t, e, o, n) {
                    (t = null == t ? i.default.out.x : t),
                        (e = null == e ? i.default.out.y : e),
                        (o = null == o ? this.goldX : o),
                        (n = null == n ? this.goldY : n);
                    for (var r = this.RandomCoordinates(t, e), a = 0; a < r.length; a++) {
                        var s = r[a];
                        this.Start_a(t, e, s, o, n);
                    }
                }),
                (e.RandomCoordinates = function (t, e) {
                    for (var o = [], n = 0; n < 360; ) {
                        var r = 350 + 50 * Math.random(),
                            a = t + r * Math.sin((n * Math.PI) / 180),
                            i = e + r * Math.cos((n * Math.PI) / 180);
                        o.push({x: a, y: i}), (n += 38);
                    }
                    return o;
                }),
                (e.Start_a = function (t, e, o, n, r) {
                    var i = this.Random_Numeric_domains(1.5, 0.7),
                        s = this.Pool.get(this.Pool);
                    null == s && (s = this.CreateItem(t, e)).addComponent(a.default).reuse(this.Pool),
                        (s.x = t),
                        (s.y = e);
                    var c = s.getComponent(a.default);
                    (c.time = i),
                        (c.p0 = {x: s.x, y: s.y}),
                        (c.p1 = {x: o.x, y: o.y}),
                        (c.p2 = {x: n, y: r}),
                        cc.Canvas.instance.node.addChild(s);
                }),
                (e.CreateItem = function (t, e) {
                    var n = new cc.Node();
                    return (
                        (n.group = this.inst.node.group),
                        (n.addComponent(cc.Sprite).spriteFrame = o.inst.sf),
                        (n.x = t),
                        (n.y = e),
                        n
                    );
                }),
                (e.Random_Numeric_domains = function (t, e) {
                    var o = t - e;
                    return Math.random() * o + e;
                }),
                (e.Pool = new cc.NodePool(a.default)),
                (e = o = r([c], e))
            );
        })(cc.Component));
o.default = l;
